Feat/nginx service#73
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @MingJ7, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces an Nginx service into the Docker Compose stack, establishing it as a central gateway for the existing PDF processor, PDF extractor, and chat services. This change aims to enhance the separation between the frontend and backend, providing a unified and stable entry point for client applications and enabling greater flexibility for future backend architectural adjustments.
Highlights
- New Nginx Gateway Service: A new
nginx_servicehas been introduced into thedocker-compose.ymlfile. This service is configured to build from a newnginx_servicedirectory, expose port 80, and depend on thepdf_extraction,pdf_processor_service, andchat_service. - FastAPI Root Path Configuration: The
FastAPIapplications inchat_service/main.py,pdf_extraction_service/main.py, andpdf_processor_service/main.pyhave been updated to include aroot_pathparameter during their initialization (e.g.,/chat,/extractor,/processor). This is crucial for these services to correctly handle requests when proxied by Nginx. - Nginx Configuration for Reverse Proxying: New Nginx configuration files (
nginx_service/Dockerfile,nginx_service/example.env,nginx_service/nginx.conf.template) have been added. Thenginx.conf.templatesets up Nginx to act as a reverse proxy, routing requests to/processor/,/extractor/, and/chat/paths to their respective backend services using environment variables for their URLs.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces an Nginx service to act as a reverse proxy gateway for the backend services. The changes are well-structured, including a new Nginx configuration, Dockerfile, and updates to the FastAPI applications to work behind the proxy. I suggest enhancing the service startup order in docker-compose.yml with health checks, removing now-unnecessary exposed ports from backend services to improve security, improving the Nginx configuration to forward essential client information to the backend services, and a minor change to improve configuration consistency. Overall, this is a great addition that will improve the architecture.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an Nginx service as a reverse proxy for the backend services. The changes in the FastAPI services to support this with root_path are correct. There's a critical issue in how requests are proxied, which would prevent the services from receiving requests correctly. A refactoring is suggested to improve the maintainability of the Nginx configuration file.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces an Nginx container to act as a gateway for the backend services. I suggest adding the env_file to the pdf_extraction_service definition, adding healthchecks to the backend services, pinning the version of the base image in the Nginx Dockerfile, and simplifying the rewrite directives in the Nginx configuration. Also, rename the FastAPI app instances to better reflect the service they belong to.
|
@NotYuSheng Please review. |
Review complete, please adjust the comments and request again @MingJ7 |
|
@NotYuSheng Adjustments have been done |
|
Approved, nice work |
Summary
Fixes #71
This pull request adds a nginx container to the compose stack to act as gateway to the pdf processor, pdf extractor and chat services.
Changes Made
Context / Rationale
This feature will allow for separation between frontend and backend. Allowing for changes in the backend architecture to be made without having to impact the frontend.
Related Docs or References
FastAPI Application Checklist
/healthendpoint is implemented and returns 200 OK after relevant path (/processor, /extractor, .chat)/docsor/redocafter relevant path (/processor, /extractor, .chat)General Checklist